﻿//------------------------------------------------------------------------------
// <copyright file="RpcErrorCodes.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

namespace Microsoft.Internal.GamesTest.Rpc.Client
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    /// <summary>
    /// A simple static class to house error codes that are expected to be seen during the process
    /// of invoking remote methods.
    /// </summary>
    internal static class RpcErrorCodes
    {
        /// <summary>
        /// The operation completed successfully.
        /// </summary>
        public const int Success = 0;

        /// <summary>
        /// The user attempted to invoke a remote method that does not exist.
        /// </summary>
        public const int GamesTestRpcErrorMethodNotFound = unchecked((int)0xE0010064); // MAKE_HRESULT(1, FACILITY_RPC, 100);

        /// <summary>
        /// Unable to find a server with the server Id provided.
        /// </summary>
        public const int GamesTestRpcErrorUnknownServerId = unchecked((int)0xE0010068);

        /// <summary>
        /// Failed to serialize the archive portion of the response.
        /// </summary>
        public const int GamesTestRpcErrorFailedToSerializeUserData = unchecked((int)0xA0010069);

        /// <summary>
        /// Failed to parse incoming socket-based RPC Request.
        /// </summary>
        public const int GamesTestRpcErrorFailedToParseRpcSocketRequest = unchecked((int)0xE001006B);

        /// <summary>
        /// The JSON received by the server was not formattly correctly.
        /// </summary>
        public const int HresultInvalidJson = unchecked((int)0x83750007);

        /// <summary>
        /// The JSON received by the server was not in the format expected.  Typically this means that it was missing
        /// a field that was required by the TDK RPC system.
        /// </summary>
        public const int HresultInvalidDataFormat = unchecked((int)0x83760002);

        /// <summary>
        /// The buffer that a user supplied to the RpcArchive::GetNamedStringValue method was too small to hold the entire string.
        /// </summary>
        public const int HresultStringBufferTooSmall = unchecked((int)0xE001006C);

        /// <summary>
        /// The value in the RpcArchive was set to null and therefore could not be retrieved.
        /// </summary>
        public const int HresultRpcArchiveValueIsNull = unchecked((int)0xE001006D);

        /// <summary>
        /// The hook tried to retrieve a member from an RpcArchive that did not exist.
        /// </summary>
        public const int HresultRpcArchiveMemberNotFound = unchecked((int)0xE001006E);

        /// <summary>
        /// The request was rejected because the server request queue is full.
        /// </summary>
        public const int HresultRequestQueueFull = unchecked((int)0xE001006F);

        /// <summary>
        /// The version of the client does not match the version of the server.
        /// </summary>
        public const int HresultRpcVersionMismatch = unchecked((int)0xE0010072);
    }
}
